package com.helen.exam03.Config;/*
 *@Author: helen
 *@Date:   2021/5/11 15:35
 *@Description:
 */

import com.helen.exam03.DataCsv.CsvData;
import com.helen.exam03.DataCsv.TransferChinese;
import com.helen.exam03.Entity.RegionStats;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.annotation.Configuration;
import java.util.LinkedList;
import java.util.List;

@Configuration
public class CsvConfig implements InitializingBean{

    public static final String DATA_URL = "https://gitee.com/dgut-sai/COVID-19/raw/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv";

    public static List<RegionStats> list;
    static {
        list = new LinkedList<>();
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        list = CsvData.handleResource(CsvData.readAResource(DATA_URL));
        TransferChinese.transferToChinese(list);
    }

}
